import React from 'react';
import {Router, Route, IndexRoute, browserHistory} from 'react-router';

//import App from '../App';
import {initWx} from '../Action/wxUtil'
import wx from 'weixin-js-sdk';

/*const wechat = async ()=>{
  await initWx();
  wx.ready(async ()=> {
    await wx.hideOptionMenu();
    //wx.showAllNonBaseMenuItem();
  })
}*/

const App = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../App').default)
  },'App')
}

const PersonalCenter = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PersonalCenter/PersonalCenter').default)
  },'PersonalCenter')
}

const NoticeCenter = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PersonalCenter/NoticeCenter').default)
  },'NoticeCenter')
}

const Authorization = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PersonalCenter/Authorization').default)
  },'Authorization')
}

const OrderList = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/OrderList').default)
  },'OrderList')
}

const AgentOrderList = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/AgentOrderList').default)
  },'AgentOrderList')
}

const StockManage = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/StockManage/StockManage').default)
  },'StockManage')
}

const MyStock = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/StockManage/MyStock').default)
  },'MyStock')
}

const MyOrderDetails = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/StockManage/MyOrderDetails').default)
  },'MyOrderDetails')
}

const Logistics = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/Logistics').default)
  },'Logistics')
}

const OrderDetails = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/OrderDetails').default)
  },'OrderDetails')
}

const AgentOrderDetails = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/AgentOrderDetails').default)
  },'AgentOrderDetails')
}

const Balance = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/MyBalance/Balance').default)
  },'Balance')
}

const PaymentForGoods = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/MyBalance/PaymentForGoods').default)
  },'PaymentForGoods')
}

const MyPoints = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/MyBalance/MyPoints').default)
  },'MyPoints')
}

const Recharge = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/MyBalance/Recharge').default)
  },'Recharge')
}

const RechargeRecord = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/MyBalance/RechargeRecord').default)
  },'RechargeRecord')
}

const RechargeDetail = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/MyBalance/RechargeDetail').default)
  },'RechargeDetail')
}

const OnlineOrder = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/OnlineOrder').default)
  },'OnlineOrder')
}

const PendingOrder = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/PendingOrder').default)
  },'PendingOrder')
}

const AgentStructure = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Agent/AgentStructure').default)
  },'AgentStructure')
}

const MyRecommend = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Agent/MyRecommend').default)
  },'MyRecommend')
}

const AgentTrail = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Agent/AgentTrail').default)
  },'AgentTrail')
}

const AgentUpgrade = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Agent/AgentUpgrade').default)
  },'AgentUpgrade')
}

const Subordinate = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Agent/Subordinate').default)
  },'Subordinate')
}

const ErCode = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PersonalCenter/ErCode').default)
  },'ErCode')
}

const ShareQrCode = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PersonalCenter/ShareQrCode').default)
  },'ShareQrCode')
}

const ToShip = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/ToShip').default)
  },'ToShip')
}

const DeliveredInformation = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/DeliveredInformation').default)
  },'DeliveredInformation')
}

const ChooseInfomation = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/ChooseInfomation').default)
  },'ChooseInfomation')
}

const ManageInformation = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/ManageInformation').default)
  },'ManageInformation')
}

const ToPower = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PersonalCenter/ToPower').default)
  },'ToPower')
}

const MyBankList = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PersonalCenter/MyBankList').default)
  },'MyBankList')
}

const ModifyBankCard = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PersonalCenter/ModifyBankCard').default)
  },'ModifyBankCard')
}

const BankInformation = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PersonalCenter/BankInformation').default)
  },'BankInformation')
}

const ShopCarts = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/ShopCarts').default)
  },'ShopCarts')
}

const GoodsDesc = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/GoodsDesc').default)
  },'GoodsDesc')
}

const AgentGrade = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Register/AgentGrade').default)
  },'AgentGrade')
}

const RechargeFirst = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Register/RechargeFirst').default)
  },'RechargeFirst')
}

const BuyFirst = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Register/BuyFirst').default)
  },'BuyFirst')
}

const Malls = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Malls/Malls').default)
  },'Malls')
}

const Index = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Index/Index').default)
  },'Index')
}

const ComfirmPayMoney = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PayMent/ComfirmPayMoney').default)
  },'ComfirmPayMoney')
}

const BanklistForlargePayment = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PayMent/BanklistForlargePayment').default)
  },'BanklistForlargePayment')
}

const WithdrawCash = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/MyBalance/WithdrawCash').default)
  },'WithdrawCash')
}

const CommissionCash = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/MyBalance/CommissionCash').default)
  },'CommissionCash')
}

const UserCenter = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PersonalCenter/UserCenter').default)
  },'UserCenter')
}

const Distribution = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/Distribution').default)
  }, 'Distribution')
}

const MyDistribution = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/MyDistribution').default)
  }, 'MyDistribution')
}

const StockDetails = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/StockManage/StockDetails').default)
  },'StockDetails')
}

const ChooseAddress = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/StockManage/ChooseAddress').default)
  },'ChooseAddress')
}

const ToPay = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PayMent/ToPay').default)
  },'ToPay')
}

const PaymentSuccess = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PayMent/PaymentSuccess').default)
  },'PaymentSuccess')
}

const ReceivingTime = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/ReceivingTime').default)
  },'ReceivingTime')
}

const ToPayStatus = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PayMent/ToPayStatus').default)
  },'ToPayStatus')
}

const Purchase = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/StockManage/Purchase').default)
  }, 'Purchase')
}

const ToWebView = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/ToWebView').default)
  },'ToWebView')
}

const ShareGoodsDesc = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/ShareGoodsDesc').default)
  },'ShareGoodsDesc')
}

const ShareToTakeCode = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/ShareToTakeCode').default)
  },'ShareToTakeCode')
}

const PublishEvalute = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/PublishEvalute').default)
  },'PublishEvalute')
}

const PurchaseOrder = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/PurchaseOrder').default)
  },'PurchaseOrder')
}

const Tip = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PersonalCenter/Tip').default)
  },'Tip')
}



const GoPicking = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/GoPicking').default)
  },'GoPicking')
}

const ToRecharge = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PayMent/ToRecharge').default)
  },'ToRecharge')
}

const ReturnGoods = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/StockManage/ReturnGoods').default)
  },'ReturnGoods')
}

const ExchangeGoods = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/StockManage/ExchangeGoods').default)
  },'ExchangeGoods')
}

const ExchangeOrder = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/ExchangeOrder').default)
  },'ExchangeOrder')
}

const ReAndChangeTest = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/StockManage/ReAndChangeTest').default)
  },'ReAndChangeTest')
}

const TestGoodsDesc = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/StockManage/TestGoodsDesc').default)
  },'TestGoodsDesc')
}

const MyReturnChange = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/StockManage/MyReturnChange').default)
  },'MyReturnChange')
}

const BindPhoneNum = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PersonalCenter/BindPhoneNum').default)
  },'BindPhoneNum')
}

const PayOrder = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Examine/PayOrder').default)
  },'PayOrder')
}

const ImagesDesc = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Examine/ImagesDesc').default)
  },'ImagesDesc')
}

const UploadImg = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/PayMent/UploadImg').default)
  },'UploadImg')
}

const MyCredentials = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/OrderManage/MyCredentials').default)
  },'MyCredentials')
}

const ShareToLogin = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Malls/ShareToLogin').default)
  },'ShareToLogin')
}

const ShareMalls = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Malls/ShareMalls').default)
  },'ShareMalls')
}

const ShareShopCarts = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Malls/ShareShopCarts').default)
  },'ShareShopCarts')
}

const Login = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Login/Login').default)
  },'Login')
}

const Register = (nextState, cb) => {
  require.ensure([], require => {
    cb(null, require('../Component/Login/Register').default)
  },'Register')
}
const RouteConfig = (
  <Router onUpdate={() => window.scrollTo(0, 0)} history={browserHistory}>
    <Route path="/" getComponent={App}>
      <IndexRoute getComponent={Login} />
      <Route path="/PersonalCenter" getComponent={PersonalCenter}/>
      <Route path="/noticeCenter" getComponent={NoticeCenter}/>
      <Route path="/authorization" getComponent={Authorization}/>
      <Route path="/orderList" getComponent={OrderList}/>
      <Route path="/agentOrderList" getComponent={AgentOrderList}/>
      <Route path="/stockManage" getComponent={StockManage}/>
      <Route path="/orderDetails" getComponent={OrderDetails}/>
      <Route path="/agentOrderDetails" getComponent={AgentOrderDetails}/>
      <Route path="/myOrderDetails" getComponent={MyOrderDetails}/>
      <Route path="/myStock" getComponent={MyStock}/>
      <Route path="/logistics" getComponent={Logistics}/>
      <Route path="/balance" getComponent={Balance}/>
      <Route path="/paymentForGoods" getComponent={PaymentForGoods}/>
      <Route path="/myPoints" getComponent={MyPoints}/>
      <Route path="/recharge" getComponent={Recharge}/>
      <Route path="/rechargeRecord" getComponent={RechargeRecord}/>
      <Route path="/rechargeDetail" getComponent={RechargeDetail}/>
      <Route path="/onlineOrder" getComponent={OnlineOrder}/>
      <Route path="/pendingOrder" getComponent={PendingOrder}/>
      <Route path="/agentStructure" getComponent={AgentStructure}/>
      <Route path="/myRecommend" getComponent={MyRecommend}/>
      <Route path="/agentTrail" getComponent={AgentTrail}/>
      <Route path="/agentUpgrade" getComponent={AgentUpgrade}/>
      <Route path="/subordinate" getComponent={Subordinate}/>
      <Route path="/erCode" getComponent={ErCode}/>
      <Route path="/shareQrCode" getComponent={ShareQrCode}/>
      <Route path="/toShip" getComponent={ToShip}/>
      <Route path="/deliveredInformation" getComponent={DeliveredInformation}/>
      <Route path="/chooseInfomation" getComponent={ChooseInfomation}/>
      <Route path="/manageInformation" getComponent={ManageInformation}/>
      <Route path="/toPower" getComponent={ToPower}/>
      <Route path="/myBankList" getComponent={MyBankList}/>
      <Route path="/modifyBankCard" getComponent={ModifyBankCard}/>
      <Route path="/bankInformation" getComponent={BankInformation}/>
      <Route path="/shopCarts" getComponent={ShopCarts}/>
      <Route path="/goodsDesc" getComponent={GoodsDesc}/>
      <Route path="/agentGrade" getComponent={AgentGrade}/>
      <Route path="/rechargeFirst" getComponent={RechargeFirst}/>
      <Route path="/buyFirst" getComponent={BuyFirst}/>
      <Route path="/malls" getComponent={Malls}/>
      <Route path="/index" getComponent={Index}/>
      <Route path="/comfirmPayMoney" getComponent={ComfirmPayMoney}/>
      <Route path="/banklistForlargePayment" getComponent={BanklistForlargePayment}/>
      <Route path="/withdrawCash" getComponent={WithdrawCash}/>
      <Route path="/commissionCash" getComponent={CommissionCash}/>
      <Route path="/userCenter" getComponent={UserCenter}/>
      <Route path="/distribution" getComponent={Distribution}/>
      <Route path="/myDistribution" getComponent={MyDistribution}/>
      <Route path="/stockDetails" getComponent={StockDetails}/>
      <Route path="/chooseAddress" getComponent={ChooseAddress}/>
      <Route path="/toPay" getComponent={ToPay}/>
      <Route path="/paymentSuccess" getComponent={PaymentSuccess}/>
      <Route path="/receivingTime" getComponent={ReceivingTime}/>
      <Route path="/toPayStatus" getComponent={ToPayStatus}/>
      <Route path="/purchase" getComponent={Purchase}/>
      <Route path="/toWebView" getComponent={ToWebView}/>
      <Route path="/shareGoodsDesc" getComponent={ShareGoodsDesc}/>
      <Route path="/shareToTakeCode" getComponent={ShareToTakeCode}/>
      <Route path="/publishEvalute" getComponent={PublishEvalute}/>
      <Route path="/purchaseOrder" getComponent={PurchaseOrder}/>
      <Route path="/goPicking" getComponent={GoPicking}/>
      <Route path="/toRecharge" getComponent={ToRecharge}/>
      <Route path="/tip" getComponent={Tip}/>
      <Route path="/returnGoods" getComponent={ReturnGoods}/>
      <Route path="/exchangeGoods" getComponent={ExchangeGoods}/>
      <Route path="/exchangeOrder" getComponent={ExchangeOrder}/>
      <Route path="/reAndChangeTest" getComponent={ReAndChangeTest}/>
      <Route path="/testGoodsDesc" getComponent={TestGoodsDesc}/>
      <Route path="/myReturnChange" getComponent={MyReturnChange}/>
      <Route path="/bindPhoneNum" getComponent={BindPhoneNum}/>
      <Route path="/payOrder" getComponent={PayOrder}/>
      <Route path="/imagesDesc" getComponent={ImagesDesc}/>
      <Route path="/uploadImg" getComponent={UploadImg}/>
      <Route path="/myCredentials" getComponent={MyCredentials}/>
      <Route path="/shareToLogin" getComponent={ShareToLogin}/>
      <Route path="/shareMalls" getComponent={ShareMalls}/>
      <Route path="/shareShopCarts" getComponent={ShareShopCarts}/>
      <Route path="/login" getComponent={Login}/>
      <Route path="/login/register" getComponent={Register}/>
    </Route>
  </Router>
);

export default RouteConfig;
